< previous page page_406 next page >

Page 406
e10a6a0a59f035e870d90cca05b85fce.gif
Dim new_x As Single

    new_x = X + Amplitude * Sin(Y * 6.28 / Period)
    Y = Y + Amplitude * Sin(X * 6.28 / Period)
    X = new_x
End Sub
Example program Distort uses this kind of class to transform a two-dimensional array of points. It then connects the points to draw a transformed grid similar to those shown in Figure 12.22.
Once you have created a transformation class, you can use it to transform graphical objects much as previous examples transform them using matrices. Write an ApplyTransformationObject subroutine that takes as a parameter a Transformation object. That routine can then invoke the transformation object's Transform method for each of the points in the object. The following code shows how a TwoDPolygon object would perform this transformation.
z0426-01.gif
Figure 12.22
Shape-distorting transformations.

 
< previous page page_406 next page >